package com.spzx.product.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.spzx.product.domain.ProductDetails;
import com.spzx.product.mapper.ProductDetailsMapper;
import com.spzx.product.service.IProductDetailsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 商品sku属性表 服务实现类
 * </p>
 *
 * @author xiongkunYang
 * @since 2025/05/26 18:30
 */
@Service
public class ProductDetailsServiceImpl extends ServiceImpl<ProductDetailsMapper, ProductDetails> implements IProductDetailsService {

    @Override
    public String[] getProductDetails(Long id) {
        // 根据商品id查询商品详情
        LambdaQueryWrapper<ProductDetails> queryWrapper = new LambdaQueryWrapper<ProductDetails>()
                .eq(ProductDetails::getProductId, id)
                .select(ProductDetails::getImageUrls);
        ProductDetails productDetails = this.baseMapper.selectOne(queryWrapper);
        return productDetails.getImageUrls().split(",");
    }
}
